/**
 * Team members:
 * HengXing Liu 2022229044
 * YiYang Zhang 2022229047
 * ZeJun Liu 2022229092
 */
package project;

import project.*;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Scanner;


public class SMAC {

    public static void main(String[] args) throws Exception {
        System.out.println("Welcome to SMAC");
        Scanner console = new Scanner(System.in);
        System.out.print("> ");
        String input = console.nextLine().trim();

        CommandEvaluator commandEvaluator = new CommandEvaluator();
        while (!input.equals("exit")) {
            try {
                Tokenizer tokenizer = new Tokenizer(input);
                commandEvaluator.setTokenizer(tokenizer);
                commandEvaluator.evaluator();
            } catch (Exception e) {
                System.out.println(e.getMessage());
                if (LogManage.flag) {
                    LogManage.WriteFile(e.getMessage() + "\n");
                }
            }
            System.out.println();
            if (LogManage.flag) {
                System.out.print(">>");
                LogManage.WriteFile(">>");
            } else {
                System.out.print("> ");
            }
            input = console.nextLine();
            if (LogManage.flag) {
                LogManage.WriteFile(input + "\n");
            }
        }
        System.out.println("Thank you for using SMAC");
        console.close();
    }
}


